﻿using Autodesk.AutoCAD.Runtime;
using System.Reflection;

namespace CADTool.NetLoad
{
    public class NetLoadX
    {
        [CommandMethod("NetLoadX")]
        public void netLoadX()
        {
            string file_dir = "";
            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
            ofd.Filter = "dll文件（*.dll）|*.dll";
            ofd.Title = "加载dll文件";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                file_dir = ofd.FileName;
            }
            else return;
            //打开文件，将文件以二进制方式复制到内存,自动关闭文件
            byte[] buffer=System.IO.File.ReadAllBytes(file_dir);
            Assembly assembly= Assembly.Load(buffer);
        }


    }
}
